import { ref, computed } from 'vue'

export const useLeaderboard = () => {
    const players = ref([
        {
            id: 'user789',
            username: 'PuzzlePro',
            level: 56,
            score: 12450,
            avatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C._EJ4gAHvtRGVBotZqOtd4gAAAA?w=166&h=180&c=7&r=0&o=5&pid=1.7'
        }
        // 其他玩家数据...
    ])

    const activeFilter = ref('weekly')

    const filteredPlayers = computed(() => {
        return [...players.value].sort((a, b) => b.score - a.score).slice(0, 10)
    })

    return { players, activeFilter, filteredPlayers }
}
